<template>
	<view class="content">
		<view class="bank_list">
			<view class="list" v-for="(item,index) in siteList" :key = 'index' v-if="siteList.length!=0" :style="'background:url('+item.bg_img+') no-repeat;background-size:100% 100%'">
				<view class=" flex  flex-bt">
					<view class="img_bank flex flex-align">
						<image :src="item.logo" mode=""></image>
						<view class="left">
							<view class="name">{{item.bank_name}}</view>
							<view class="u-font-xs">**** **** **** {{item.bank_card}}</view>
						</view>
					</view>
					
					<view class="right">
						<text><tui-icon name="delete" :size="20" color="#fff" @click='del(item.id)'></tui-icon></text>
					</view>
				</view>
				<view class="flex flex-align flex-end mt20">
					{{item.mCardNo}}
				</view>		
			</view>
		</view>
		<view class="addSite" @tap="toAddSite">
			<view class="add">
				<tui-icon name="plus" color="#fff" class="icon" :size="20"></tui-icon>添加银行卡
			</view>
		</view>
		<view class="empty-box" v-if='siteList.length==0'>
			<image src="/static/ic_nodata.png" mode=""></image>
			<view>暂无数据</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				siteList: [],
				page:1,
				is_show:false
			};
		},
		onLoad() {
		},
		onShow() {
			let that = this
			that.page = 1
			that.siteList = []
			that.getData()
		},
		methods: {
			getData() {
				let that = this
				that.tui.request("api.auth.center/bankList", "GET", {}, false, true, true).then((res) => {
					that.siteList = res.data.list
					
				}).catch((res) => {})
			},
			del(e){
				let that = this
				that.tui.request("api.auth.center/bankDec", "GET", {id:e}, false, true, true).then((res) => {
					that.tui.toast(res.info)
					if(res.code==1){
						setTimeout(function(){
							that.page = 1
							that.siteList = []
							that.getData()
						},1000)
					}
					
				}).catch((res) => {})
			},
			eit(e){
				uni.navigateTo({
					url:'/pages/bank/eit_bank?id='+e
				})
			},
			toAddSite(){
				uni.navigateTo({
					url:'/pages/bank/add_bank'
				})
			},
		}
	};
</script>

<style lang="scss">
	page{background: #f2f2f2;}
	.bank_list{padding: 30rpx 30rpx 130rpx;
		.list{background: #fff;border-radius: 15rpx;padding:50rpx 30rpx 30rpx;margin-bottom: 30rpx;color: #fff;font-family: cursive;font-weight: 700;
			.img_bank{
				image{width: 100rpx;height: 100rpx;margin-right: 10rpx;}
			}
			.name{font-size: 38rpx;margin-bottom: 10rpx;}
			.right{
				text{margin-left: 20rpx;}
			}
		}
		.mt20{margin-top: 20rpx;font-size: 34rpx;}
	}
	.addSite {
		display: flex;
		justify-content: space-around;
		width: 600rpx;
		line-height: 90rpx;
		position: fixed;
		bottom: 30rpx;
		left: 80rpx;
		background: $base;
		border-radius: 60rpx;
		font-size: 30rpx;z-index: 1111;
		.add{
			display: flex;
			align-items: center;
			.icon{
				margin-right: 10rpx;
			}
			color: #fff;
		}
	}
	.empty-box{text-align: center;padding-top: 60rpx;
		view{color: #999;}
	}
</style>